package net.sudot.chess.event.game;

import net.sudot.chess.business.model.Customer;
import net.sudot.chess.business.model.Room;
import org.springframework.context.ApplicationEvent;

/**
 * 游戏事件
 *
 * @author tangjialin on 2018-06-16.
 */
public abstract class GameEvent extends ApplicationEvent {

    /** 房间信息 */
    private Room room;
    /** 玩家信息 */
    private Customer customer;

    /**
     * 构建新的事件
     *
     * @param source   事件最初发生的对象
     * @param room     房间信息
     * @param customer 玩家信息
     */
    public GameEvent(Object source, Room room, Customer customer) {
        super(source);
        this.room = room;
        this.customer = customer;
    }

    /**
     * 获取房间信息
     *
     * @return 返回房间信息
     */
    public Room getRoom() {
        return room;
    }

    /**
     * 获取玩家信息
     *
     * @return 返回玩家信息
     */
    public Customer getCustomer() {
        return customer;
    }
}
